package com.atguigu.crowd.handler;

import com.atguigu.crowd.api.MySQLRemoteService;
import com.atguigu.crowd.entity.vo.PortalTypeVO;
import com.atguigu.crowd.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author yzt
 * @create 2021-09-22 16:48
 */
@Controller
public class PortalHandler {

    @Autowired
    private MySQLRemoteService mySQLRemoteService;

    @RequestMapping("/")
    public String showPortalPage(Model model){

        ResultEntity<List<PortalTypeVO>> typeProjectEntity = mySQLRemoteService.getPortalTypeProjectDataRemote();

        if("SUCCESS".equals(typeProjectEntity.getOperationResult())){
            model.addAttribute("portal_data",typeProjectEntity.getQueryData());
        }

        return "portal";
    }
}
